<?php
require_once('lanceur_spip.php');
include_spip('functions/pdk_common');
require_once(_DIR_PLUGIN_PDK.'classes/simpletest/class.PdkModelTest.php');

class TestClassPdkRubriqueModel extends PdkModelTest {
    public function __construct(){               
        parent::__construct();
        
        $this->SetPdkModel('PdkRubriqueModel', pdk_load_class('PdkRubriqueModel', 'classes/models'));
        
        //$this->dropTestTables = false;
    }
    
    /**
     *  Run before each test
     */
    function setUp() {
        parent::setUp();
    }
    
    /**
     *  Run after each test
     */
    function tearDown() {
        parent::tearDown();
    }
    
    /**
     *  Run after all tests
     */ 
    function __destruct() {
        // Call parent destructor to delete created tables
        parent::__destruct();
    }
    
    public function testCheckRubriqueInRubrique() {
        $this->assertTrue($this->model->CheckRubriqueInRubrique(2,1));    
        $this->assertTrue($this->model->CheckRubriqueInRubrique(3,1));
        
        $this->assertFalse($this->model->CheckRubriqueInRubrique(4,1));
        
        $this->assertFalse($this->model->CheckRubriqueInRubrique(1,2));
        $this->assertFalse($this->model->CheckRubriqueInRubrique(1,3));
        $this->assertFalse($this->model->CheckRubriqueInRubrique(1,4));
        
        $this->assertFalse($this->model->CheckRubriqueInRubrique(2,3));
        $this->assertFalse($this->model->CheckRubriqueInRubrique(2,4));
		
		// When id_rubrique and id_rubrique_belong are equal - method must return true
		$this->assertTrue($this->model->CheckRubriqueInRubrique(1,1));
    }   
}
?>